<template>
  <div class="employees-container">
    <div class="app-container">
      <el-card>
        <!-- 标签页组件 -->
        <el-tabs v-model="currSel">
          <el-tab-pane
            name="account"
            label="登录账户设置"
          >
            <!-- 账户设置 -->
            <LoginSet :user-detail="userDetail" />
          </el-tab-pane>
          <el-tab-pane
            label="个人详情"
            name="detail"
          >
            <!-- 个人详情 -->
            <UserInfo :user-detail="userDetail" />
          </el-tab-pane>
        </el-tabs>
      </el-card>
    </div>
  </div>
</template>

<script>
import UserInfo from './components/user-info.vue'
import LoginSet from './components/login-setting.vue'
import { getUserDetailById } from '@/api/user.js'
export default {
  components: {
    UserInfo,
    LoginSet
  },
  data () {
    return {
      // 员工详情数据
      userDetail: {},
      currSel: 'detail'
    }
  },
  created () {
    this.getUserDetail()
  },
  methods: {
    async getUserDetail () {
      const userDetail = await getUserDetailById(this.$route.params.id)
      // console.log(userDetail)
      this.userDetail = userDetail
    }
  }
}
</script>

<style lang="scss" scoped>
</style>
